package com.zhenmyan.secdeal.config;

import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.Queue;
import org.springframework.amqp.core.TopicExchange;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;


/**
 * description:
 *
 * @author 颜真明
 * @date 2023/5/15  2:03
 */
@Configuration
public class RabbitMQConfig {

    private static final String SEC_DEAL_TOPIC_EXCHANGE = "sec_deal_topic_exchange";

    @Bean
    public Queue queue(){
        return new Queue("queue", true);
    }

    @Bean
    public Queue secDealQueue(){
        return new Queue("secDealQueue", true);
    }

    @Bean
    public TopicExchange secDealTopicExchange(){
        return new TopicExchange(SEC_DEAL_TOPIC_EXCHANGE);
    }

    @Bean
    public Binding binding() {
        return BindingBuilder.bind(secDealQueue()).to(secDealTopicExchange()).with("secDeal");

    }


}
